﻿<!DOCTYPE html>
<html ng-app="myModule" >
  <head>
    <meta charset="UTF-8">
    <title>基本构造</title>
  
      <script src="../JS/angular.min.js"></script>
     <!-- <script src="../JS/angularIE.min.js"></script>-->
    <script type="text/javascript">
        var myModule = angular.module("myModule", []); // 第一个是参数的名称 第二个表示这个Module依赖那些module 字符串数组
        myModule.controller('ParentController', ['$scope', function ($scope) {
            $scope.user = {
                Name: 'test',
                Age: 18
            }
            $scope.mobile = "iphone";
        }]);
        myModule.controller('ChildController', ['$scope', function ($scope) {
            $scope.user = {
                Name: 'test2',
                Age: 18
            }
        }]);
    </script>
  </head>
<body >
    <div  ng-controller="ParentController">
        <h1>Parent</h1>
         <p>Name:{{user.Name}}</p>
          <p>Age:{{user.Age}}</p>
        <p>mobile:{{mobile}}</p>
       <div ng-controller="ChildController">
           <h1>Sub</h1>
          <p>Name:{{user.Name}}</p>
          <p>Age:{{user.Age}}</p>
           <p>mobile:{{mobile}}</p>
      </div>
      
     </div>

  </body>
</html>
